package com.eke.serviceimpl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.eke.bean.UserConcern;
import com.eke.dao.UserConcernDao;
import com.eke.service.UserConcernService;

@Service
public class UserConcernServiceImpl implements UserConcernService {

	@Resource
	private UserConcernDao ucd;

	
	/**
	 * 查询用户被关注量
	 * 
	 * @param useConcernId
	 *            用户id
	 * @return int
	 */
	public int qurryUserConcernTotal(int userConcernId) {
		// TODO Auto-generated method stub
		return ucd.qurryUserConcernTotal(userConcernId);
	}

	/**
	 * 查询用户关注量
	 * 
	 * @param useId
	 *            用户id
	 * @return int
	 */
	
	public int qurryUserConcernTotalByUserId(int userId) {
		// TODO Auto-generated method stub
		return ucd.qurryUserConcernTotalByUserId(userId);
	}

	/**
	 * 是否关注用户
	 * 
	 * @param userId
	 *            用户id
	 * @param userConcernId
	 *            被关注用户id
	 * @return Boolean
	 */
	
	public Boolean isAddUserConcern(int userId, int userConcernId) {
		// TODO Auto-generated method stub
		return ucd.isAddUserConcern(userId, userConcernId);
	}

	/**
	 * 关注用户
	 * 
	 * @param userConCern
	 *            用户关注对象
	 * @return {@link Boolean} 关注成功返回true 失败返回false
	 */
	
	public Boolean addUserConcern(UserConcern userConCern) {
		// TODO Auto-generated method stub
		return ucd.insert(userConCern) > 0;
	}

	/**
	 * 取消关注用户
	 * 
	 * @param userId
	 *            关注用户id
	 * @param userConcernId
	 *            被取消关注的用户id
	 */
	
	public Boolean cencelUserConcern(int userId, int userConcernId) {
		// TODO Auto-generated method stub
		return ucd.cencelUserConcern(userId, userConcernId);
	}
}
